Re: [GENERAL] Data type recommendation - Mailing list pgsql-general

From Herouth Maoz
Subject Re: [GENERAL] Data type recommendation
Date
Msg-id l03130302b3cdbf9992a3@[147.233.159.109]
Whole thread Raw
In response to Data type recommendation  (Thomas Lim <englim@pc.jaring.my>)
List pgsql-general
At 11:02 +0300 on 04/08/1999, Thomas Lim wrote:


> According to the user guide, it is mentioned that TEXT data type is
> recommended over CHAR or VARCHAR.  Does anyone know why?  I thought the
> access time for TEXT is slower.  Shouldn't CHAR be used for key fields?
> Is there some sort of overheads for CHAR or VARCHAR that TEXT is
> recommended?  Hope that someone has an answer to this recommendation.

Text and Varchar are represented in the same way, but Text is preferred
because it has no maximum limit (except, of course, the notorious tuple
size).

I don't know if this still holds in 6.5, though I think it is, but indeed,
fixed-size fields have a better access time than variable-length fields
(thus CHAR is better than TEXT), provided that they are in the beginning of
the tuple (that is, they don't come after any variable-length column).

However, they are space-wasteful. CHAR types take the same storage space,
with spaces added on the right, regardless of the fact that the actual data
is shorter.

Herouth

--
Herouth Maoz, Internet developer.
Open University of Israel - Telem project
http://telem.openu.ac.il/~herutma



pgsql-general by date:

Previous
From: Herouth Maoz
Date:
Subject: Re: [GENERAL] problems compiling scripts.I'm near suicide
Next
From: Howie
Date:
Subject: Re: [GENERAL] Query buffer problem.